//
//  GZ_CollectionVIewCell.m
//  B段项目
//
//  Created by 高哲 on 15/11/11.
//  Copyright © 2015年 谢美娜. All rights reserved.
//

#import "GZ_CollectionVIewCell.h"

@implementation GZ_CollectionVIewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _bigImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_bigImageView];
        
        _NewImageView = [[UIImageView alloc] init];
        [_bigImageView addSubview:_NewImageView];
        
        _titleLabel = [[myTitleLabel alloc] init];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_titleLabel];
        
        _authorLabel = [[UILabel alloc] init];
        _authorLabel.textColor = [UIColor colorWithRed:0.17 green:0.33 blue:0.54 alpha:1];
        _authorLabel.font = [UIFont systemFontOfSize:14];
        _authorLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_authorLabel];
        
        _contectLabel = [[UILabel alloc] init];
        _contectLabel.textColor = [UIColor lightGrayColor];
        _contectLabel.font = [UIFont systemFontOfSize:14];
        _contectLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_contectLabel];
        
        _iconImageView = [[UIImageView alloc] init];
        _iconImageView.image = [UIImage imageNamed:@"GZguangbo.png"];
        [self.contentView addSubview:_iconImageView];
        
        _peopleLabel = [[UILabel alloc] init];
        _peopleLabel.textColor = [UIColor lightGrayColor];
        _peopleLabel.font = [UIFont systemFontOfSize:12];
        _peopleLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_peopleLabel];
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    _bigImageView.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, 100 * FitWidth, 100 * FitHeight);
    _NewImageView.frame = CGRectMake(0, 0, 35 * FitWidth, 35 * FitHeight);
    _titleLabel.frame = CGRectMake(_bigImageView.frame.size.width + _bigImageView.frame.origin.x + 10 * FitWidth, _bigImageView.frame.origin.y, 160 * FitWidth, 30 * FitHeight);
    _authorLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height, 150 * FitWidth, 25 * FitHeight);
    _contectLabel.frame = CGRectMake(_authorLabel.frame.origin.x, _authorLabel.frame.origin.y + _authorLabel.frame.size.height, 200 *FitWidth, 25 * FitHeight);
    _iconImageView.frame = CGRectMake(280 * FitWidth, _titleLabel.frame.origin.y + 8 * FitHeight, 15 * FitWidth, 15 * FitHeight);
    _peopleLabel.frame = CGRectMake(_iconImageView.frame.origin.x + _iconImageView.frame.size.width + 5 * FitWidth, _iconImageView.frame.origin.y, 70 * FitWidth, _iconImageView.frame.size.width);
}

- (void)setRadioModel:(GZ_RadioModel *)radioModel
{
    [_bigImageView sd_setImageWithURL:[NSURL URLWithString:radioModel.coverimg] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    _bigImageView.layer.cornerRadius = 8.0;
    _bigImageView.layer.masksToBounds = YES;
     if (radioModel.isnew == 1) {
         _NewImageView.image = [UIImage imageNamed:@"GZnew.png"];
       }
    _titleLabel.text = radioModel.title;
    _contectLabel.text = radioModel.desc;
    _peopleLabel.text = [NSString stringWithFormat:@"%@", radioModel.count];
    //_authorLabel.text = [NSString stringWithFormat:@"by:%@", [radioModel.userinfo valueForKey:@"uname"]];
    

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
